package com.abai.doubi.utils;

import com.alibaba.nls.client.AccessToken;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

@Slf4j
public class AliTokenUtil {
    public static final String  AK_ID = "your-aliyun-access-key-id";
    public static final String  AK_SECRET = "your-aliyun-access-key-secret";

    public static String getToken(){
        try {
            AccessToken accessToken = new AccessToken(AK_ID, AK_SECRET);
            accessToken.apply();
            String token = accessToken.getToken();
            return token;
        } catch (IOException e) {
            log.error("获取阿里云token失败");
            return null;
        }
    }

}
